package thread;

import java.text.ParseException;

/**
 * 多线程并发执行
 * 修改同一份共享数据
 *
 * 取消共享的途径,解决线程不安全
 * 借助类同包类 DataUtil
 */
public class ThreadLocalDemo {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            for (int i = 0; i < 5; i++) {
//                System.out.println(Thread.currentThread().getName());
                System.out.println(DateUtil.parse("2023/06/01"));

            }
        });
        Thread t2 = new Thread(()->{
            for (int i = 0; i < 5; i++) {
//                System.out.println(Thread.currentThread().getName());
                System.out.println(DateUtil.parse("2023/06/02"));
;
            }
        });
        t1.start();
        t2.start();


    }
}
